import AMapLoader from '@amap/amap-jsapi-loader';

export const aMapLoader = async () => {
  const key = '25afdc51ff976b456a3d4f6197783057';
  const version = '2.0';
  const securityJsCode = '628f980272e9a6e4122f80dbd2b539c0';
  const plugins = ['AMap.MarkerCluster', 'AMap.ToolBar', 'AMap.ControlBar', 'AMap.RangingTool', "AMap.TileLayer", "AMap.InfoWindow",];
  if (!window['_AMapSecurityConfig']) {
    window['_AMapSecurityConfig'] = securityJsCode;
  }
  await AMapLoader.load({
    key: key,
    version: version,
    plugins: plugins,
    Loca: {
      // 是否加载 Loca， 缺省不加载
      version: '2.0.0', // Loca 版本，缺省 1.3.2
    },
  });
};
